/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.com.entidad;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author 841756
 */
@Entity
@Table(name = "tblcajacompensacion")
@NamedQueries({
    @NamedQuery(name = "Tblcajacompensacion.findAll", query = "SELECT t FROM Tblcajacompensacion t"),
    @NamedQuery(name = "Tblcajacompensacion.findByCodCajacom", query = "SELECT t FROM Tblcajacompensacion t WHERE t.codCajacom = :codCajacom"),
    @NamedQuery(name = "Tblcajacompensacion.findByNomCajacom", query = "SELECT t FROM Tblcajacompensacion t WHERE t.nomCajacom = :nomCajacom"),
    @NamedQuery(name = "Tblcajacompensacion.findByNitCajacom", query = "SELECT t FROM Tblcajacompensacion t WHERE t.nitCajacom = :nitCajacom")})
public class Tblcajacompensacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "cod_cajacom")
    private Short codCajacom;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nom_cajacom")
    private String nomCajacom;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nit_cajacom")
    private String nitCajacom;
    @JoinColumn(name = "cod_compania", referencedColumnName = "cod_compania")
    @ManyToOne(optional = false)
    private Tblcompania codCompania;
    @JoinColumn(name = "id_estado", referencedColumnName = "id_estado")
    @ManyToOne(optional = false)
    private TblEstado idEstado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "caja")
    private List<Tbldatosgenerales> tbldatosgeneralesList;

    public Tblcajacompensacion() {
    }

    public Tblcajacompensacion(Short codCajacom) {
        this.codCajacom = codCajacom;
    }

    public Tblcajacompensacion(Short codCajacom, String nomCajacom, String nitCajacom) {
        this.codCajacom = codCajacom;
        this.nomCajacom = nomCajacom;
        this.nitCajacom = nitCajacom;
    }

    public Short getCodCajacom() {
        return codCajacom;
    }

    public void setCodCajacom(Short codCajacom) {
        this.codCajacom = codCajacom;
    }

    public String getNomCajacom() {
        return nomCajacom;
    }

    public void setNomCajacom(String nomCajacom) {
        this.nomCajacom = nomCajacom;
    }

    public String getNitCajacom() {
        return nitCajacom;
    }

    public void setNitCajacom(String nitCajacom) {
        this.nitCajacom = nitCajacom;
    }

    public Tblcompania getCodCompania() {
        return codCompania;
    }

    public void setCodCompania(Tblcompania codCompania) {
        this.codCompania = codCompania;
    }

    public TblEstado getIdEstado() {
        return idEstado;
    }

    public void setIdEstado(TblEstado idEstado) {
        this.idEstado = idEstado;
    }

    public List<Tbldatosgenerales> getTbldatosgeneralesList() {
        return tbldatosgeneralesList;
    }

    public void setTbldatosgeneralesList(List<Tbldatosgenerales> tbldatosgeneralesList) {
        this.tbldatosgeneralesList = tbldatosgeneralesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codCajacom != null ? codCajacom.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tblcajacompensacion)) {
            return false;
        }
        Tblcajacompensacion other = (Tblcajacompensacion) object;
        if ((this.codCajacom == null && other.codCajacom != null) || (this.codCajacom != null && !this.codCajacom.equals(other.codCajacom))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "" + nomCajacom + "";
    }
    
}
